home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / vopl / glvopl.lha / glvopl / gpp / gpp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-07  |  1.5 KB  |  110 lines

  1. /*
  2.  *   gpp
  3.  *  
  4.  *   Graph plotting programme. 
  5.  *
  6.  */
  7. #ifdef SGI_GL
  8. #include "gl.h"
  9. #include "device.h"
  10. #else
  11. #include "vogl.h"
  12. #include "vodevice.h"
  13. #endif
  14. #include "gpp.h"
  15.  
  16. /*
  17.  * main driver
  18.  */
  19. main(argc, argv)
  20.     int    argc;
  21.     char    **argv;
  22. {
  23.     int    i;
  24.     char    cm[2];
  25.     graph    *p;
  26.  
  27.     short    val;
  28.         Screencoord    left, right, bottom, top;
  29.  
  30.     doargs(argc, argv);
  31.  
  32.     /*vinit(device);*/
  33.     prefsize(1000, 750);
  34.     winopen("GPP");
  35.     qdevice(KEYBD);
  36.  
  37.     /*
  38.      * Zap initial REDRAW
  39.      */
  40.  
  41.     qread(&val);
  42.  
  43.     reshapeviewport();
  44.     color(BLACK);
  45.     clear();
  46.  
  47.     pushviewport();
  48.  
  49.         getviewport(&left, &right, &bottom, &top);
  50.  
  51.     /* It's supposed to be 4:3 ratio ... */
  52.         viewport(left,
  53.                 right  - (short)(0.25 * (right - left)),
  54.                 bottom,
  55.                 top - (short)(0.05 * (top - bottom)));
  56.  
  57.  
  58.     color(WHITE);
  59.  
  60.     if (fontname[0])
  61.         hfont(fontname);
  62.     else
  63.         hfont("futura.l");
  64.  
  65.     readgraphs();
  66.     
  67.     if (!uxscale || !uyscale /* || !uzscale */) 
  68.         for (p = gp; p != (graph *)NULL; p = p->nxt) {
  69.             if (!uxscale)
  70.                 adjustscale(p->x, p->npnts, 'x');
  71.  
  72.             if (!uyscale)
  73.                 adjustscale(p->y, p->npnts, 'y');
  74.  
  75.             /*if (!uzscale)
  76.                 adjustscale(p->z, p->npnts, 'z');*/
  77.         }
  78.  
  79.     axistitle(xlabel, 'x');
  80.     axistitle(ylabel, 'y');
  81.     /*axistitle(zlabel, 'z');*/
  82.  
  83.     drawaxes2();
  84.     drawtitle();
  85.  
  86.     i = 0;
  87.     cm[1] = '\0';
  88.  
  89.     hfont("markers");
  90.  
  91.     linewidth(2);
  92.     for (p = gp; p != (graph *)NULL; p = p->nxt) {
  93.         color((i % 7) + 1);
  94.         cm[0] = 'a' + (i++);
  95.         marker(cm);
  96.         plot2(p->x, p->y, p->npnts);
  97.     }
  98.  
  99.     linewidth(1);
  100.  
  101.     popviewport();
  102.     if (do_legend)
  103.         drawlegend();
  104.  
  105.  
  106.     qread(&val);
  107.  
  108.     gexit();
  109. }
  110.